<?php

namespace System\Models;

class Timezones extends \System\Core\Model
{

    private $_timezones;
    
    function __construct()
    {
        parent::__construct();
        
        $this->_timezones = array(
          
            '-12' =>   '[UTC - 12:00] Enewetak, Kwajalein',
            '-11' =>   '[UTC - 11:00] Midway Island, Samoa',
            '-10' =>   '[UTC - 10:00] Hawaii',
            '-9.5' =>  '[UTC - 9:30] French Polynesia',
            '-9' =>    '[UTC - 9:00] Alaska',
            '-8' =>    '[UTC - 8:00] Pacific Time (US &amp; Canada)',
            '-7' =>    '[UTC - 7:00] Mountain Time (US &amp; Canada)',
            '-6' =>    '[UTC - 6:00] Central Time (US &amp; Canada), Mexico City',
            '-5' =>    '[UTC - 5:00] Eastern Time (US &amp; Canada), Bogota, Lima',
            '-4' =>    '[UTC - 4:00] Atlantic Time (Canada), Caracas, La Paz',
            '-3.5' =>  '[UTC - 3:30] Newfoundland',
            '-3' =>    '[UTC - 3:00] Brazil, Buenos Aires, Falkland Is.',
            '-2' =>    '[UTC - 2:00] Mid-Atlantic, Ascention Is., St Helena',
            '-1' =>    '[UTC - 1:00] Azores, Cape Verde Islands',
            '0' =>     '[UTC] Casablanca, Dublin, London, Lisbon, Monrovia',
            '1' =>     '[UTC + 1:00] Brussels, Copenhagen, Madrid, Paris',
            '2' =>     '[UTC + 2:00] Kaliningrad, South Africa',
            '3' =>     '[UTC + 3:00] Baghdad, Riyadh, Moscow, Nairobi',
            '3.5' =>   '[UTC + 3:30] Tehran',
            '4' =>     '[UTC + 4:00] Abu Dhabi, Baku, Muscat, Tbilisi',
            '4.5' =>   '[UTC + 4:30] Kabul',
            '5' =>     '[UTC + 5:00] Ekaterinburg, Karachi, Tashkent',
            '5.5' =>   '[UTC + 5:30] Bombay, Calcutta, Madras, New Delhi',
            '5.75' =>  '[UTC + 5:45] Kathmandu',
            '6' =>     '[UTC + 6:00] Almaty, Colombo, Dhaka',
            '6.5' =>   '[UTC + 6:30] Yangon, Naypyidaw, Bantam',
            '7' =>     '[UTC + 7:00] Bangkok, Hanoi, Jakarta',
            '8' =>     '[UTC + 8:00] Hong Kong, Perth, Singapore, Taipei',
            '8.75' =>  '[UTC + 8:45] Caiguna, Eucla',
            '9' =>     '[UTC + 9:00] Osaka, Sapporo, Seoul, Tokyo, Yakutsk',
            '9.5' =>   '[UTC + 9:30] Adelaide, Darwin',
            '10' =>    '[UTC + 10:00] Melbourne, Papua New Guinea, Sydney',
            '10.5' =>  '[UTC + 10:30] Lord Howe Island',
            '11' =>    '[UTC + 11:00] Magadan, New Caledonia, Solomon Is.',
            '11.5' =>  '[UTC + 11:30] Burnt Pine, Kingston',
            '12' =>    'UTC + 12:00] Auckland, Fiji, Marshall Island',
            '12.75' => '[UTC + 12:45] Chatham Islands',
            '13' =>    '[UTC + 13:00] Kamchatka, Anadyr',
            '14' =>    '[UTC + 14:00] Kiritimati',
          
        );
    }
    
    /**
     * Returns all timezones in an array if no zone is specified, else it
     * returns the name of that particular zone.
     * @param float $time the zone that you want returned.
     * @return mixed returns an associative array with all the timezones or
     * if $zone is specified it returns a string with the name of that zone.
     */
    public function getTimezones($zone = NULL)
    {
        if ($zone === NULL)
        {
            return $this->_timezones;
        }
        else
        {
            foreach ($this->_timezones as $key => $value)
            {
                if ($zone === $key)
                {
                    return $value;
                }
            }
        }
        return '';
    }

}

?>
